<%@ page contentType="text/html; charset=UTF-8"%>
<%@page import="java.util.*"%>
<%@ include file="../include/taglib.jsp"%>
<%@ page import="com.sinodata.bsm.common.constants.ResConstants" %>
<%@ page import="com.sinodata.bsm.center.bean.*" %>
<%@ page import="com.sinodata.bsm.common.vo.*" %>
<%
Long initResId = (Long)request.getAttribute("resId");
String[] healthArr = ResConstants.HEALTH_DESC;
boolean hasEditResPrivilege = (Boolean)request.getAttribute("hasEditResPrivilege");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>资源信息查看</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="expires" content="0" />
		<%@ include file="../include/common.jsp"%>
		<%@ include file="../include/table.jsp"%>
		
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/default/bsm/perf/res_listPage.css" />
		<style>
*{
	font-size:12px;
	margin:0 auto;
	padding:0;
}
ul, ul li{
	list-style:none;
	}
.xUl-ul,{
	display:block;
	float:left;
	
}
.xUl li{
	line-height:26px;
}
.xUl li .xUl-ul li{
	line-height:12px;
	}
.xUl-ul li{
	width:100px;
	margin-right:18px;
	margin-bottom:2px;
}
.xUl{
	border-bottom:1px #aaa dotted;
	padding-bottom:4px;
	width:100%;
	display:block;
	float:left;
}
.contentDiv{
	background:#fafafa;
	width:500px;
	height:380px;
	margin-top:10px;
	border:1px solid #eee;
	padding:5px 5px 5px 10px;
}
.h2-a{
     width:16px;
     height:16px; 
     display:block;
     float:right;
     background:url(../style/default/bsm/images/edit.gif) no-repeat left top;
     margin-right:8px;
     margin-top:4px;
  }
  .h2-a:hover{
   background:url(../style/default/bsm/images/edit-hover.gif) no-repeat left top;
   cursor:pointer;
   }
  .h2-a1{
     width:16px;
     height:16px; 
     display:block;
     float:right;
     background:url(../style/default/bsm/images/delete.png) no-repeat left top;
     margin-right:8px;
     margin-top:4px;
  }
    .h2-a1:hover{
     background:url(../style/default/bsm/images/delete-hover.png) no-repeat left top;
     cursor:pointer;
   }
    .span-a{
   width:16px;
   height:16px;
   background:url(../style/default/datatable/images/delete.png) no-repeat left top;
   display:block;
   float:right;
   margin-right:6px;
   }
 .span-a:hover{
    background:url(../style/default/datatable/images/delete-hover.png) no-repeat left top;
   }  
   .span-a1{
   width:16px;
   height:16px;
   background:url(../style/default/datatable/images/add.png) no-repeat left top;
   display:block;
   float:right;
   margin-right:6px;
   }
   .span-a1:hover{
    background:url(../style/default/datatable/images/add-hover.png) no-repeat left top;
   }  
.searchFormStyle label{
   width:30px;
   height:20px;
   line-height:20px;
   padding:0 4px 0 20px;
   margin-left:3px;
   float:left;
   }
 .renlin{
	background:url(../style/default/bsm/images/ack.gif) no-repeat 12px 3px;
}
.w-200{
			width:30%;
			float:left;
		}
.w-500{
	float:right;
	width:70%;
}
.w-500 a{
	float:right;
	width:auto;
	background-position-x:0px;
	padding-left:0;
	text-decoration:none;
	cursor:pointer;
}
.w-500 a:hover{
	text-decoration:underline;
}
.statuValue{
	
}
</style>
		<script type="text/javascript" src="${pageContext.request.contextPath}/resources/charts/FusionCharts.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/resources/charts/FusionCharts.jqueryplugin.js"></script>
		
		<script type="text/javascript">
			var initResId = '<%=initResId%>';
			var viewId ='${viewId}';
			var healthArr = new Array();
			<%
				for(int i=0; i<healthArr.length; i++){
			%>
				healthArr['<%=i+1%>'] = '<%=healthArr[i]%>';
			<%		    
				}
			%>
			
		</script>
	    <script type="text/javascript" src="${pageContext.request.contextPath}/js/app/res-query-view.js"></script>
	</head>
<body  style="height: 95%;">

	<div class="column" id="top" style="overflow: hidden;">
		<div class="col-main">
			<!--基本信息-->	
			<div class="col-l-extra" style="overflow:hidden;">
			     	<h2 class="title-h2"><span style="float:left;">基本信息</span>
			     	<%	if(hasEditResPrivilege ){%>
						  <c:if test="${viewId!=null&&viewId!=''}">
		   					<c:if test="${parentRes==null}">
		   						<a class="h2-a1" title="删除本资源" id ="modifyBt" onclick="deleteChildRes('<%=initResId%>',1);"  ></a>
		   					</c:if>
		   					<a  class="h2-a" title="修改资源"  style="margin-left:<% if(request.getAttribute("parentRes")!=null){out.println("71%");}else{out.println("45%");} %>;"   onclick="initUpdate('${resId}','${parentRes.id}','${viewId}')" ></a>
						  </c:if>
						<% }  %>
					</h2>
				<div style="height:93%;overflow-y:auto; width:100%">	
				  <ul class="col-l-ul">
					<li style="margin-top:5px;"><span class="col-l-ul-l">资源名称：</span><span class="col-l-ul-r" id="resname" ></span></li>
					<li><span class="col-l-ul-l">类型：</span><span class="col-l-ul-r" ><a href="#" id="restypename" target="_blank" title="查看资源类别定义" ></a></span></li>
					<li><span class="col-l-ul-l">IP：</span><span class="col-l-ul-r" id="resip"></span></li>
					<li><span class="col-l-ul-l">Probe：</span><span class="col-l-ul-r" id="resProbe"></span></li>
					<li id = "pausedStatusLi"><span class="col-l-ul-l">监控状态：</span><span class="col-l-ul-r"  id="pausedStatus">已暂停</span></li>
					<li><h3>当前健康状况：<span id='resstatus'></span></h3></li>
					<li style="height:83px;" >
					<span class="col-l-ul-l" id="chartdiv">
					</span>
  					<span class="col-l-ul-r">
					<%
						for(int i=0; i<healthArr.length; i++){
			    			out.println("<p class='color-a-"+(i+1)+"'>"+healthArr[i]+"</p>");	
						}
					%>										
					</span>		
					</li>
				 </ul>
				<ul class="col-l-ul" id="attUl">
					<li><h3>配置属性</h3></li>
				</ul>
		  </div>
			</div>
			<!--@end基本信息-->	
			<!--图表-->	
			<div class="col-r-main" >
				<h2 class="title-h2">
				<span style="background-image:none; height:20px;">子资源列表<label id="childResCount"></label></span>
				<%	if(hasEditResPrivilege ){%>
				<c:if test="${viewId!=null&&viewId!=''}">
					<span style="float:right;margin-right:0px; height:20px; margin-top:4px; background-image:none;" id = "toolbar" >
					   <a class="page_delete span-a" title="删除资源" href="#" onclick="deleteChildRes()"></a>
						<a class="page_add span-a1" title="添加父子关系" href="#" onclick="openResRelationWindow()"></a>			
					</span>
				</c:if>
				<% }  %>
				</h2>
				<div id="childs" class="col-l-extra" style="width:100%; height:316px; border:0px;overflow-x: hidden;"></div>
			</div>
			<!--@end图表-->	
		</div>
	</div>

<div  id="eventListDiv" style="overflow: hidden;">
	<h2 onclick="showEvent();" class="title-h2" style="text-align:left"><span><img src="${pageContext.request.contextPath}/style/default/bsm/images/arrow-down.gif"/></span>资源活动事件</h2>
	<div class="toolbar w-200" id = "toolbar" >
		<c:if test="${viewId!=null&&viewId!=''}">
			<a class="page_add renlin" href="#" onclick="batchAck()">认领</a>
	 		<a class="page_delete" href="#" onclick="batchConfirm()" >清除</a>
	 		<a class="page_excel" href="#" onclick="eventDown()" >导出</a>
	 		<!-- 	<a class="page_find" href="#" onclick="showCondition();" style="float:right;display:none;">高级查询</a> -->
	 	</c:if> 
	</div>
	
	<div class="toolbar w-500" id = "toolbar" >
			<a onclick="onclickLevel('');"><div id="eventlevel">全部(<label id="allEvent" class="allEvent" ></label>)</div></a>
	 		<a id="eventlevel2" class="eventlevel2" onclick="onclickLevel('2');"><div id="eventlevel2">轻微(<label id="level2" class="statuValue" ></label>)</div></a>
	 		<a id="eventlevel3" class="eventlevel3" onclick="onclickLevel('3');"><div id="eventlevel3">警告(<label id="level3" class="statuValue" ></label>)</div></a>
	 		<a id="eventlevel4" class="eventlevel4" onclick="onclickLevel('4');"><div id="eventlevel4">重要(<label id="level4"  class="statuValue"></label>)</div></a>
	 		<a id="eventlevel5" class="eventlevel5" onclick="onclickLevel('5');"><div id="eventlevel5">严重(<label id="level5" class="statuValue"></label>)</div></a>
	 		<a class="status0" onclick="onclickLevel('0');"><div id="status0">未认领(<label id="claimNo" class="statuValue"></label>)</div></a>
	 		<a class="status1" onclick="onclickLevel('1');"><div id="status1">已认领(<label id="claimOk" class="statuValue"></label>)</div></a>
	</div>
	<div class="searchFormStyle" id="searchFormDiv"  style="display:none;">
		<form>
			<table>  
				<tr>
					<td>
						<label style="width:60px; text-align:left; padding:0px;">事件级别：</label>
						<input style="margin-top:3px;" type="checkbox" checked="checked" name="level" id="level1" value="2" ><label style= "background:url(../style/default/images/2.gif) no-repeat top left;">轻微</label>
						<input style="margin-top:3px;" type="checkbox" checked="checked" name="level" id="level2" value="3" ><label style= "background:url(../style/default/images/3.gif) no-repeat top left;">警告</label>
						<input style="margin-top:3px;" type="checkbox" checked="checked" name="level" id="level3" value="4" ><label style= "background:url(../style/default/images/4.gif) no-repeat top left;">重要</label>
						<input style="margin-top:3px;" type="checkbox" checked="checked" name="level" id="level4" value="5" ><label style= "background:url(../style/default/images/5.gif) no-repeat top left;">严重</label>
					</td>
					<td style="padding:0px 10px 0px 10px;">
						<label style="width:60px; text-align:left; padding:0px;">事件状态：</label>
						<input style="margin-top:3px;" type="checkbox" checked="checked" name="status" id="status1" value="0" ><label style="width:55px; text-align:right; padding:0px; background:url(../style/default/bsm/images/unclaimed.gif) no-repeat top left;">未认领</label>
						<input style="margin-top:3px; margin-left:8px;" type="checkbox" checked="checked" name="status" id="status2" value="1" ><label style="width:55px; text-align:right; padding:0px; background:url(../style/default/bsm/images/hasBeenClaimed.gif) no-repeat top left;">已认领</label>
					</td>
					<td>
						<input type="button" value="查询" class="searchFormButtonStyle" onclick="search()" />
					</td>
				</tr>
	
			</table>
		</form>
	</div>
	<table id="eventList" width="100%" cellpadding="0" cellspacing="0" border="0" class="display">
		<thead>
			<tr>
				<th width="20px"><input style="position:static;" title="全选" type='checkbox' name='dt_check_all' id="dt_check_all" onclick="allClick()" /></th>
				<th width="30px">状态</th>
				<th width="30px">级别</th>
				<th >事件内容</th>
				<th width="20%">事件类别</th>
				<th width="10%">资源名称</th>
				<th width="20%">产生时间</th>
			</tr>
		</thead>
	</table>
</div>
	</body>
</html>
